<template>
    <section id="section">
      <div  style="padding-top: 20px;">
        <div class="card">
          <p class="titlep">
            <span class="title">病历资料</span>
            <span class="updatebutton" @click="update(MedicalRecord)">修改资料</span>
          </p>
          <p class="row" style="margin-top: 10px;">
            <span class="titletxt">姓名：</span>
            <span >{{MedicalRecord.Name}}</span>
          </p>
          <p class="row">
            <span class="titletxt">基础状况：</span>
            <span >
              <span v-if="MedicalRecord.Gender==0">男</span>
              <span v-if="MedicalRecord.Gender==1">女</span>
              &nbsp;
            {{setNum(MedicalRecord.Birthday)}} &nbsp;{{MedicalRecord.Weight}}<span v-if="MedicalRecord.Weight">Kg</span></span>
          </p>
          <p class="row">
            <span class="titletxt">癌症名称：</span>
            <span >{{MedicalRecord.TumorName}}</span>
          </p>
          <p class="row">
            <span class="titletxt">确诊时间：</span>
            <span >{{setNum(MedicalRecord.DiagnosticTime)}}</span>
          </p>
          <p class="row">
            <span class="titletxt">家族史：</span>
            <span>{{MedicalRecord.FamilyHistory}}</span>
          </p>
          <p class="row">
            <span class="titletxt">人脑状况：</span>
            <span>{{MedicalRecord.BrainCondition}}</span>
          </p>
          <p class="textarea" style="padding-bottom: 20px;">
            <span class="titletxt" style="color: gray;">体力状况：</span>
            <span class="textarea">{{MedicalRecord.PhysicalCondition}}</span>
          </p>
        </div>
      </div>
      <div style="margin-top: 10px;">
        <div class="rode">
          <span class="name">{{a.Type}}</span>
          <p>
            <span>{{a.Content}}</span>
            <span>{{setNum(a.RecordTime)}}</span>
          </p>
          <span class="img" @click="addPictureReport(a)">
            <img src="../../assets/arrow.png" alt="">
          </span>
        </div>
      </div>
     <!--/////////////////-->
      <div style="margin-top: 10px;">
        <div class="rode">
          <span class="name">{{b.Type}}</span>
          <p>
            <span>{{b.Content}}</span>
            <span>{{setNum(b.RecordTime)}}</span>
          </p>
          <span class="img" @click="addPictureReport(b)">
            <img src="../../assets/arrow.png" alt="">
          </span>
        </div>
      </div>
      <!--jjjjjjjjjj-->
      <div style="margin-top: 10px;">
        <div class="rode">
          <span class="name">{{c.Type}}</span>
          <p>
            <span>{{c.Content}}</span>
            <span>{{setNum(c.RecordTime)}}</span>
          </p>
          <span class="img" @click="addPictureReport(c)">
            <img src="../../assets/arrow.png" alt="">
          </span>
        </div>
      </div>
<!--ujuuuuuuuuuuuuuuu-->
      <div style="margin-top: 10px;">
        <div class="rode">
          <span class="name">{{d.Type}}</span>
          <p>
            <span>{{d.Content}}</span>
            <span>{{setNum(d.RecordTime)}}</span>
          </p>
          <span class="img" @click="addPictureReport(d)">
            <img src="../../assets/arrow.png" alt="">
          </span>
        </div>
      </div>
      <!--ddddddddddd-->
      <div style="margin-top: 10px;">
        <div class="rode">
          <span class="name">{{e.Type}}</span>
          <p>
            <span>{{e.Content}}</span>
            <span>{{setNum(e.RecordTime)}}</span>
          </p>
          <span class="img" @click="addPictureReport(e)">
            <img src="../../assets/arrow.png" alt="">
          </span>
        </div>
      </div>



    </section>
</template>

<script>
  import {Indicator  } from "mint-ui";
  import {getCaseRecordList,getCaseShowInfoByCaseId} from "../../api/api"
    export default {
        props: [],
        name: 'app',
        data(){
            return {
              MedicalRecord: {},
                a:{Type:"病理报告",Content:"暂无数据",RecordTime:"暂无数据"},
                b:{Type:"影像报告",Content:"暂无数据",RecordTime:"暂无数据"},
                c:{Type:"检查报告",Content:"暂无数据",RecordTime:"暂无数据"},
                d:{Type:"出院记录",Content:"暂无数据",RecordTime:"暂无数据"},
                e:{Type:"自由添加",Content:"暂无数据",RecordTime:"暂无数据"},
            }
        },
        computed: {},
        components: {},
        created(){
        },
        methods: {
          update(item){
              this.$router.push({
                name:'新增病历(基础)',
                params:{item:item}
              });
          },
          addPictureReport:function(item){
            this.$router.push({
              name:'新增病历(图片)',
              params:{item:item}
            })
          },
          setNum(item) {
            if (item) {
              return item.slice(0, 10);
            }
          },
          getCaseRecordList(){
            getCaseRecordList(localStorage.getItem("RecordId")).then(res=>{
              for(var i in res.data.Result){
                  if(res.data.Result[i].Type=="病理报告"){
                      this.a=res.data.Result[i];
                  }
                  else if(res.data.Result[i].Type=="影像报告"){
                    this.b=res.data.Result[i];
                  }
                  else if(res.data.Result[i].Type=="检查报告"){
                    this.c=res.data.Result[i];
                  }
                  else if(res.data.Result[i].Type=="出院记录"){
                    this.d=res.data.Result[i];
                  }
                  else if(res.data.Result[i].Type=="自由添加"){
                    this.e=res.data.Result[i];
                  }
              }
            });
          },
          getCaseShowInfoByCaseId(){
            Indicator.open({
              spinnerType: 'fading-circle'
            });
            getCaseShowInfoByCaseId(localStorage.getItem("RecordId")).then(res=>{
                this.MedicalRecord=res.data.Result;
                Indicator.close();
            });
          }
        },
        mounted() {
          document.getElementById("section").style.minHeight=localStorage.getItem("windowHeight")+"px";
          this.getCaseRecordList();
          this.getCaseShowInfoByCaseId();
        },
        destroyed(){
        }
    }
</script>

<style lang="scss" scoped>
  #section{
    background-color: rgba(220, 220, 220, 0.2);
  }
  .card{
    width: 90%;
    margin: 0 auto;
    border-radius: 5px;
    background-color: white;
    margin-bottom: 30px;
    .titlep{
      width: 90%;
      height:40px;
      margin: 0 auto;
      border-bottom: 1px solid rgba(0, 0, 0, 0.1);
      .title{
        display: inline-block;
        width: 100px;
        height:40px;
        line-height: 40px;
      }
      .title{
        float:left;
        text-align: left;
      }
    }
    .title:before{
      content:"";
      display: inline-block;
      width: 3px;
      height: 15px;
      background-color: rgba(0, 146, 252, 0.5);
      vertical-align: middle;
      margin-right: 5px;
      border-radius: 5px;
    }
    .row{
      width: 90%;
      height: 25px;
      margin: 0 auto;
      text-align: left;
      span{
        font-size: 13px;
        display: inline-block;
        line-height: 25px;
      }
      .titletxt{
        width: 80px;
        color: gray;
      }
    }
    .textarea{
      display: flex;
      width: 90%;
      margin: 0 auto;
      .titletxt{
        width:105px !important;
        text-align: left;
      }
      span{
        font-size: 13px;
        line-height: 25px;
        text-align: left;
      }
    }
  }
  .updatebutton{
    float: right;
    font-size: 13px;
    border: 1px solid rgba(0, 146, 252, 0.5);
    color: rgba(0, 146, 252, 0.7);
    display: inline-block;
    height: 24px;
    padding-left: 8px;
    padding-right: 8px;
    line-height: 25px;
    border-radius: 24px;
    margin-top: 8px;
  }
  .rode{
    width: 90%;
    height:55px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    background-color: white;
    border-radius: 5px;
    span{
      display: inline-block;
    }
    span:nth-child(2){
      color: gray;
    }
    .name{
      width:40px;
      height:40px;
      float: left;
      background-image: url("../../assets/404.png");
      background-size: 100% auto;
      color: white;
      margin-left: 5px;
      font-size: 15px;
      line-height: 20px;
    }
    p{
      width:70%;
      margin-left: 10px;
      text-align: left;
      font-size: 12px;
      span{
        width: 100%;
        line-height: 20px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
    .img{
      margin-left: 5%;
      img{
        width:8px;
      }
    }
  }
  .add{
    width: 90%;
    height: 40px;
    margin: 0 auto;
    margin-top: 30px;
    border-radius: 5px;
    color: white;
    text-align: center;
    line-height: 45px;
    letter-spacing: 3px;
    background-color: rgba(0, 146, 252, 0.5);
  }
</style>
